package org.aspectsense.middleware;

import java.util.Comparator;


/**
 * This Comparator will be passed on the {@link UtilityQueue} class
 * in order to sort the {@code PriorityQueue} argument of the {@code services2Wrappers} 
 * hashmap in the {@link Repository} class according to the Utility of each service
 * @author Costas Kakousis
 *s
 */
public class UtilityComparator implements Comparator<ServiceWrapper> {
	

	@Override
	public int compare(ServiceWrapper o1, ServiceWrapper o2) {
		if( ((ServiceWrapper)o1).getUtility() >= ((ServiceWrapper)o2).getUtility() )
			return 1;
		else
			return -1;
		
	}

}
